package com.gitee.dolt.security.properties;

import cn.hutool.core.util.IdUtil;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;

import java.util.List;

/**
 * 属性
 *
 * @author LYH
 */
@Data
@ConfigurationProperties(prefix = SecurityProperties.PREFIX)
public class SecurityProperties {
    public static final String PREFIX = "dolt.security";
    private JwtProperties jwt = new JwtProperties();
    private PermissionProperties permission = new PermissionProperties();


    @Data
    public static class PermissionProperties {
        /**
         * 是否启用uri权限
         */
        private Boolean enabled = true;
        /**
         * 权限是否区分大小写
         */
        private Boolean caseSensitive = false;
    }

    @Data
    public static class JwtProperties {

        /**
         * 是否启用短token
         */
        private Boolean shortToken = false;

        /**
         * 是否启用token验证
         */
        private Boolean enabled = true;

        /**
         * 加密串
         */
        private String secret = IdUtil.simpleUUID();


        /**
         * 过期时间 秒
         */
        private Long expire = 0L;

        /**
         * 拥有此token的请求进来将不需任何权限。方便内部调用
         */
        private String noAuthToken;

    }
}
